<%--
  Created by IntelliJ IDEA.
  User: jshand
  Date: 2022-10-19
  Time: 14:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.neuedu.web.entity.Role" %>
<%@ page import="java.util.List" %>
<%@ page import="java.text.SimpleDateFormat" %>


<html>
<head>
    <title>Title</title>
</head>
<body>


<a href='<%=request.getContextPath()%>/role/role_add.jsp'>添加</a>
<table width='100%' border='1' cellpadding='0' cellspacing='0'>
    <tr>
        <td>序号</td>
        <td>角色名称</td>
        <td>创建时间</td>


        <td>操作</td>
    </tr>
    <%

        List<Role> roles = (List<Role>) request.getAttribute("roles");
        for (int i = 0; i < roles.size(); i++) {
            Role role = roles.get(i);
    %>
    <tr>

        <td><%=i%>
        </td>
        <td><%=role.getRoleName()%> </td>


        <%
            String formatCreteTime = "";
            if (role.getCreatetime() != null) {
                formatCreteTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(role.getCreatetime());
            }
        %>

        <td><%=formatCreteTime%>
        </td>


        <td><a href='<%=request.getContextPath()%>/role?_type=delete&id=<%=role.getRoleId()%>'>删除</a> &nbsp;&nbsp; <a
                href='<%=request.getContextPath()%>/role?_type=toEdit&id=<%=role.getRoleId()%>'>更新</a>
        </td>
    </tr>
    <%}%>

</table>

</body>
</html>
